<template>
  <ul>
    <li v-for="item in menuItems" :key="item.key">
      <a v-if="item.route" :href="`${item.route}`">{{ item.label }}</a>
      <span v-else>{{ item.label }}</span>
      <Directory v-if="item.children" :menuItems="item.children" />
    </li>
  </ul>
</template>

<script setup lang="ts">
import Directory from './Directory.vue'
import type { MenuItems } from '../layout/menu/menu' // 导入 MenuItem 类型
// 导入 MenuItem 类型

const props = defineProps<{
  menuItems: MenuItems[]
}>()
</script>
